package com.apes.hr.transfer.model;


import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.generator.ApesGenerator;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 功能：调动申请  角色列表
 * @author FengJiaJing
 * @create 2018-07-03 11:20
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = TransferApplicationRole.CONST_TABLE_NAME)
public class TransferApplicationRole extends Model {
    public static final String CONST_TABLE_NAME = "hr_transfer_application_role";

    @Id
    @Column(name = "id")
    @ApesGenerator(code = CONST_TABLE_NAME, name = "调动单角色", padding = 15)
    private Integer id; //编码

    @Column(name = "post_id")
    private String postId; // 岗位编码

    @Column(name = "post_name")
    private String postName; // 岗位名称

//    @ManyToOne(fetch = FetchType.LAZY)
//    @JoinColumn(name = "post_id", referencedColumnName = "id")
//    private Post post; // 岗位编码


    @ManyToOne(fetch=FetchType.LAZY,cascade=CascadeType.ALL)
    @JoinColumn(name = "transferApplication_item_id",  nullable = false) //referencedColumnName = "id",
    private TransferApplicationItem transferApplicationItems;



}
